#!/bin/sh

case "$1" in
	start)
		modpath=/lib/modules/$(uname -r)
		while IFS= read -r m; do
			[ -n "$(echo $m | grep '^\s*#')" ] && continue
			[ -f "$modpath/$m" ] && /sbin/insmod $modpath/$m
		done <<- END
			# insmod dump reg
			#dump_reg.ko
			#dump_reg_misc.ko
			#insmode smc
			#sunxi-smc.ko
			# insmode sid
			#sunxi-sid.ko
			# insmod pm
			#sunxi_thermal.ko
			#nvmem_sunxi_sid.ko
			#cpufreq-dt.ko
			#cpufreq-dt-platdev.ko
			#sun50i-cpufreq-nvmem.ko
			#standby_debug.ko
			# insmod usb
			#ehci-hcd.ko
			#ehci-pci.ko
			#ohci-hcd.ko
			#ohci-pci.ko
			#sunxi-hci.ko
			#ehci-sunxi.ko
			#ohci-sunxi.ko
			#udc-core.ko
			#sunxi_usb_udc.ko
			#sunxi_usbc.ko
			#usbhid.ko
			# insmod spi
			#spi-sunxi.ko
			# insmod pwm
			#pwm-sunxi.ko
			# insmod lradc
			#sunxi-lradc.ko
			# insmod audio-codec
			#snd_soc_sunxi_jack.ko
			#snd_soc_sunxi_pcm.ko
			#snd_soc_sunxi_internal_codec.ko
			#snd_soc_sunxi_aaudio.ko
			#snd_soc_sunxi_machine.ko
			# insmod ve
			#sunxi-ve.ko
			# insmod dma_heap
			#system_heap.ko
			#cma_heap.ko
			# insmod csi & isp
			#videodev.ko
			#videobuf2-common.ko
			#videobuf2-memops.ko
			#videobuf2-dma-contig.ko
			#videobuf2-v4l2.ko
			#vin_io.ko
			#gc5025_mipi.ko
			#gc2385_mipi.ko
			#vin_v4l2.ko
			#disp.ko

END
		;;
	stop)
		;;
	restart|reload)
		"$0" stop
		"$0" start
		;;
	*)
		echo "Usage: $0 {start|stop|restart}"
		exit 1
esac

exit $?

